<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>promise面试题</title>
  </head>
  <body>
    <script>
      /* Promise.resolve(1)
        .then(Promise.resolve(2))
        .finally(() => 3)
        .then(console.log); */

      Promise.resolve()
        .then(() => {
          console.log(0);
          return Promise.resolve(4);
        })
        .then(res => {
          console.log(res);
        });

      Promise.resolve()
        .then(() => {
          console.log(1);
        })
        .then(() => {
          console.log(2);
        })
        .then(() => {
          console.log(3);
        })
        .then(() => {
          console.log(5);
        })
        .then(() => {
          console.log(6);
        });
    </script>
  </body>
</html>
